<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<title>订单管理</title>
	<link rel="stylesheet" href="/layui/css/layui.css">
	<link rel="stylesheet" href="/hyqcss/public.css">
	<style type="text/css">
		body{
			background: #e9e9e9;
		}
		/*公共头部带搜索*/
		.public_container{
			margin: 20px;
			background: #fff;
		}
		.public_title_container{
			height: 54px;
			padding: 0 20px;
			font-size: 14px;
			display: flex;
			align-items: center;
			background: #f9f9f9;
			border-bottom: 1px solid #f0f0f0;
		}
		.public_title_container a{
			margin-right: 30px;
			height: 54px;
			line-height: 54px;
			cursor: pointer;
		}
		.public_title_active{
			color: #1E9FFF;
			border-bottom: 1px solid #1E9FFF;
		}
		.public_buttonSearch_container{
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 20px;
			background: #fff;
		}
		.public_Search_container{
			position: relative;
		}
		.public_Search_container input{
			width: 240px;
			height: 32px;
			border: 1px solid #d9d9d9;
		}
		.public_Search_container i{
			position: absolute;
			bottom: 6px;
			right: 10px;
			cursor: pointer;
		}
		/*公共头部带搜索 end*/
		.public_Search_content{
			display: flex;
		}
		.public_SearchSelect_content input{
			height: 32px;
		}
		.public_SearchSelect_content{
			margin-right: 10px;
		}
		.public_buttonSearch_content{
			display: flex;
		}
		.public_buttonSearch_content a{
			color: #fff;
			background-color: #1E9FFF;
			text-shadow: 0 -1px 0 rgba(0,0,0,.12);
			height: 24px;
			padding: 4px 15px;
			font-size: 14px;
			border-radius: 2px;
			display: flex;
			align-items: center;
		}
		.public_buttonSearch_content span{
			color: rgba(0,0,0,0.65);
			background-color: #fff;
			height: 32px;
			padding: 4px 15px;
			font-size: 14px;
			border-radius: 2px;
			display: flex;
			align-items: center;
			border: 1px solid #d9d9d9;
			margin-left: 10px;
		}
		.public_buttonSearch_daoruhuashu{
			margin-left: 10px;
		}
	</style>
</head>
<body>
	<div class="public_container">
		<!-- /*公共头部带搜索*/ -->
		<div class="public_content">
			<div class="public_title_container">
				<a href="javascript::viod(0)" class="public_title_active">店铺管理</a>
				<a href="javascript::viod(0)">订单管理</a>
			</div>
			<div class="public_buttonSearch_container">
				<div class="public_buttonSearch_content">
					<a href="javascript:void(0);" class="add_store">添加店铺</a>
				</div>
				
				<div class="public_Search_content">
					
				</div>
				
			</div>

		</div>
		<!-- /*公共头部带搜索*/ end -->
		<!-- 公共表格部分 -->
		<form class="layui-form">
			<div class="public_table_container">
				<table class="layui-table" lay-skin="line">
					<colgroup>
						<col width="20%">
						<col width="10%">
						<col width="20%">
						<col width="15%">
						<col width="35%">
					</colgroup>
					<thead>
						<tr>
							<th>店铺名称</th>
							<th>订单量</th>
							<th>订单时间范围</th>
							<th>上次导入时间</th>
							<th>操作</th>
						</tr> 
					</thead>
					<tbody>
						{loop $shops as $shop}
						<tr>
							<td>{$shop->shop_name}</td>
							<td>{$shop->order_total}</td>
							<td>{$shop->start_order_time ? date("Y-m-d H:i:s", $shop->start_order_time) : ''} - {$shop->end_order_time ? date("Y-m-d H:i:s", $shop->end_order_time) : ''}</td>
							<td>{$shop->last_iport_time ? date("Y-m-d H:i:s", $shop->last_iport_time) : '-'}</td>
							<td>
								<a class="table-public-btn import-file" data-id="{$shop->id}">导入订单</a>
								<a class="table-public-btn delete-shop" data-id="{$shop->id}">删除</a>
							</td>
						</tr>
						{/loop}
					</tbody>
				</table>
			</div>
				<!-- 公共表格部分 end-->
			<div class="main-container-h pageing-container-h">
		        <div class="pageing-content-h">
		           <span>{$p->totalnum}条/{$p->totalpage}页</span> 
		        </div>
				<ul class="pageing-content-h">
		           {P weidogsadmin}
				</ul>
		    </div>
		</form>
		
	</div>
	<script src="/cdn/jquery.js"></script>
	<script src="/layui/layui.js"></script>
	<script src="/js/ajax.js"></script>
	<script type="text/javascript">
		// 弹窗
		layui.use('layer', function(){
			var layer = layui.layer;
		}); 
		// 表单
		layui.use('form', function(){
			var form = layui.form;

		  //监听提交
		  form.on('submit(formDemo)', function(data){
		  	layer.msg(JSON.stringify(data.field));
		  	return false;
		  });
		});
		$('.add_store').on('click',function(){
			layer.open({
				type: 2,
				title: '添加店铺',
				shadeClose: true,
				shade: 0.2,
				area: ['700px', '250px'],
				content: 'add_shop.html'
			}); 
		})
		$('.delete-shop').on('click',function(){
			let _this = $(this);
			let id = _this.data('id');
			layer.confirm('确定要删除该店铺吗？', { icon: 7, title:'提示'}, function(index) {
				myAjaxPost(false, true, 'delete_shop.html', { id:id}, function (resp) {
			        if (resp.status == 'success') {
			            tusi(resp.msg);
						_this.parent().parent().remove();
			        }else{
			            tusi(resp.msg);
			        }
				});
				layer.close(index);
			});
		})
		$('.import-file').on('click',function(){
			let  id = $(this).data('id');
			layer.open({
				type: 2,
				title: '导入订单',
				shadeClose: true,
				shade: 0.2,
				area: ['700px', '450px'],
				content: 'import_order.html?id='+id
			}); 
		})
	</script>
	<script type="text/javascript">
		$(".public_title_container a").click(function(e){
			if($(this).hasClass('active')) return;
			location.href = 'order.html';
		})

		function copyToClip(content, message) {
			var aux = document.createElement("input"); 
			aux.setAttribute("value", content); 
			document.body.appendChild(aux); 
			aux.select();
			document.execCommand("copy"); 
			document.body.removeChild(aux);
			if (message == null) {
				layer.msg("复制成功");
			} else{
				layer.msg(message);
			}
		}
	</script>
</body>
</html>